package app.maker.entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import java.util.Date;
/**
 * The persistent class for the entree database table.
 * 
 */
@Entity
@Table(name = "entree")
@NamedQuery(name = "Entree.findAll", query = "SELECT e FROM Entree e")
public class Entree implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private byte produitFini;
	private float quantite;
	private String typeEntree;
	private Produit produit;
	private User user;
	private Date dateEntree;
	
	public Entree() {
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	public Date getDateEntree() {
		return this.dateEntree;
	}

	public void setDateEntree(Date dateEntree) {
		this.dateEntree = dateEntree;
	}

	@Column(nullable = false)
	public byte getProduitFini() {
		return this.produitFini;
	}

	public void setProduitFini(byte produitFini) {
		this.produitFini = produitFini;
	}

	@Column(nullable = false)
	public float getQuantite() {
		return this.quantite;
	}

	public void setQuantite(float quantite) {
		this.quantite = quantite;
	}

	@Column(nullable = false, length = 45)
	public String getTypeEntree() {
		return this.typeEntree;
	}

	public void setTypeEntree(String typeEntree) {
		this.typeEntree = typeEntree;
	}

	// bi-directional many-to-one association to Produit
	@ManyToOne(cascade = { CascadeType.ALL })
	@JoinColumn(name = "idProduit", nullable = false)
	public Produit getProduit() {
		return this.produit;
	}

	public void setProduit(Produit produit) {
		this.produit = produit;
	}

	// bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name = "userID", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}